<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="../Ajs/vue.js"></script>
    <script src="../Ajs/vue-router.js"></script>
</head>
<body>
<div id="box">


    <router-link to="/user/1">user1</router-link>
    <router-link to="/user/2">user2</router-link>
    <router-link to="/user/3">user3</router-link>
    <router-view></router-view>

</div>

    <script>

        const User = {
            props:["id"],
            template:"<div>{{id}}</div>"
        };

        var router = new VueRouter({


            routes:[
                {path:"/",redirect:"/user"},
                {path:"/user/:id",component:User,props:true},
            ]
        });

        var vm = new Vue({
            el:"#box",
            //挂载路由实例对象
            router:router,
            data:{

            }
        })
    </script>
</body>
</html>